<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="css/mui.min.css" rel="stylesheet"/>
</head>
<style type="text/css">
    body {
        background-color: white;
    }

    #main {
        width: 100%;
        padding: 5px;
    }

    #head {
        /*text-align: center;*/
        padding: 5px;
        line-height: 35px;
        padding-top: 15px;
    }

    #time {
        padding: 5px;
    }
</style>

<body>
<h3 id="head"></h3>
<p id="time"></p>
<div id="main" class="content">

</div>
<script src="js/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
    function GetQueryString(key) {
        // key为url变量名称
        console.log(key);
        var urlGets = location.search.substr(1);
        if (urlGets.length > 0) {
            start = urlGets.indexOf(key + '=');
            console.log(start);
            if (start != -1) {
                start = start + key.length + 1;
                end = urlGets.indexOf('&', start);
                if (end == -1) {
                    end = urlGets.length;

                }
                return decodeURIComponent(urlGets.substring(start, end));
            }
        }
        return '';
    }
    mui.init();
    var isios = 0;
    //判断终端开始
    var browser = {
        versions: function () {
            var u = navigator.userAgent, app = navigator.appVersion;
            return {
                trident: u.indexOf('Trident') > -1, //IE内核
                presto: u.indexOf('Presto') > -1, //opera内核
                webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
                mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
                iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('iPad') > -1, //是否iPad
                webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
                weixin: u.indexOf('MicroMessenger') > -1, //是否微信 （2015-01-22新增）
                qq: u.match(/\sQQ/i) == " qq" //是否QQ
            };
        }(),
        language: (navigator.browserLanguage || navigator.language).toLowerCase()
    };
    if (browser.versions.ios) {
        isios = 1;
    }

        var a= window.location.href;
    var aid=a.split("=");
    var id = aid[1];
    	id = 24;
        var address;

  //  var address = 'http://192.168.1.11:80';
    if (isios == 1) {
        address = "http://zqxq.newzqxq.com/";
        getmation(address);
    } else {
   address = "http://new.yytaomeng.com/";
   getmation(address);
    }

    function getmation(address) {

        console.log(id);
        $.ajax({
            type: "get",
            url: address + "/web/consult/selectbyid",
            async: true,
            contentType: "application/json; charset=utf-8",
            data: {
                "id": id
            },
            dataType: 'jsonp',
            jsonp: "callback",
            jsonpCallback: "successCallback",
            success: function (data) {

                console.log(JSON.stringify(data));
             console.log(data);
                document.getElementById("main").innerHTML = data.data[0].content;
                document.getElementById("head").innerHTML = data.data[0].title;
                document.getElementById("time").innerHTML = data.data[0].time +
                    '&nbsp&nbsp来源:' + data.data[0].username;
               imgs();
            },
            error: function (error) {
                mui.toast("获取失败，请重试！");
            }
        });
    }
    function imgs(){

       $('#main').find("img").each(function(){
            var dataImg=$(this);
            var width=dataImg.attr("width");
           var offWidth=$("body").innerWidth();
           if(width>offWidth){
               dataImg.attr({"width":"",height:""}).css({"width":"80%","height":""});
           }else{
               dataImg.attr({"width":""});
           }
        });

       /* var dataImg= $('#main').find("img");
        var width=dataImg.attr("width");
        var offWidth=$("body").innerWidth();
       */
    }
</script>
</body>
</html>